package com.abc.mapper;

import com.abc.entity.User;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

public interface UserMapper {
    @Select("select * from user where username = #{username}")
    @Results(id = "userMap", value = {
            @Result(property = "id", column = "id", javaType = Integer.class,jdbcType = JdbcType.INTEGER,id = true),
            @Result(property = "username", column = "username",javaType = String.class,jdbcType = JdbcType.VARCHAR),
            @Result(property = "password", column = "password",javaType = String.class,jdbcType = JdbcType.VARCHAR),
            @Result(property = "xingming", column = "xingming",javaType = String.class,jdbcType = JdbcType.VARCHAR),
            @Result(property = "shenfen", column = "shenfen",javaType = String.class,jdbcType = JdbcType.VARCHAR)})

    User selectByUsername(String username);
    @Insert("insert into user(username,password,xingming,shenfen) values(#{username},#{password},#{xingming},#{shenfen})")
    int insertUser(User user);
    @Select("select * from user where username=#{username}")
    User findByUsername(String username);
}
